package soulkun.library.custom.activity

import android.app.Activity
import android.content.Intent
import android.graphics.drawable.Drawable
import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_about.*
import kotlinx.android.synthetic.main.activity_xy.*
import soulkun.library.component.BaseActivity
import soulkun.library.utils.R
import soulkun.library.utils.screen.ScreenUtils

class AboutActivity : BaseActivity(true) {

    companion object{

        fun startIntent(activity: Activity, appIcon: String, appName: String, appVersion: String, qqEmail: String) {
            val intent = Intent(activity, AboutActivity::class.java)
            intent.putExtra("appIcon", appIcon)
            intent.putExtra("appName", appName)
            intent.putExtra("appVersion", appVersion)
            intent.putExtra("qqEmail", qqEmail)
            activity.startActivity(intent)
        }

    }

    override fun setLayout(): Int {
        return R.layout.activity_about
    }

    override fun initIntent() {
    }

    override fun initView() {
        val appIcon = intent.getStringExtra("appIcon")
        val appName = intent.getStringExtra("appName")
        val appVersion = intent.getStringExtra("appVersion")
        val qqEmail = intent.getStringExtra("qqEmail")
        ScreenUtils.setBlackStatusText(this)
        iv_about_app_logo.setImageURI(Uri.parse(appIcon))
        tv_about_app_name.text = appName
        tv_about_app_version.text = "版本：$appVersion"
        tv_about_QQ.text = "联系我们\n$qqEmail"
    }

    override fun initData() {
    }

    override fun initListener() {
        tv_about_back.setOnClickListener { finish() }
    }

}